﻿using Adnc.Application.Shared.Dtos;
using Adnc.Application.Shared.Enum;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace WYT.Ord.Application.Contracts.Dtos.Order
{
    /// <summary>
    /// 订单创建Dto
    /// </summary>
    public class OrderCreationDto : IInputDto
    {
        /// <summary>
        /// 支付方式
        /// 1：微信 
        /// 2：余额 
        /// 3：购物金
        /// 4: 积分
        /// </summary>
        public EnumPayMode PayMode { get; set; }

        /// <summary>
        /// 付款应用
        /// 1：微信公众号
        /// 2：微信小程序
        /// 3：APP
        /// </summary>
        public int PayApp { get; set; }

        /// <summary>
        /// 支付密码(钱包支付时必填)
        /// </summary>
        public string Pass { get; set; }

        /// <summary>
        /// 推荐人
        /// </summary>
        public long? Reference { get; set; }

        /// <summary>
        /// 买家留言
        /// </summary>
        public string BuyerMessage { get; set; }

        /// <summary>
        /// 商品列表
        /// </summary>
        public List<ProductDto> Products { get; set; }

        /// <summary>
        /// 地址ID
        /// </summary>
        public long AddressId { get; set; }

        /// <summary>
        /// 优惠券
        /// </summary>
        public List<long> CouponIds { get; set; }

        /// <summary>
        ///是否购物车数据
        /// </summary>
        public bool IsShoppingCart { get; set; } = false;

        /// <summary>
        /// 订单类型 1:普通订单 2：体验装兑换订单 3:购买至云仓订单 4：云仓自提订单 5：通排调补订单
        /// </summary>
        public int Type { get; set; }
    }

    /// <summary>
    /// 商品对象
    /// </summary>
    public class ProductDto
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        [Required]
        public long GoodsId { get; set; }

        /// <summary>
        /// 商品规格ID
        /// </summary>
        [Required]
        public long SizeId { get; set; }

        /// <summary>
        /// 商品数量
        /// </summary>
        [Range(minimum: 1, maximum: int.MaxValue, ErrorMessage = "商品数量不能为0")]
        public int Count { get; set; }
    }
}
